//
//  ChangePwdViewController.m
//  wtshoppingcite
//
//  Created by TW on 14-12-8.
//  Copyright (c) 2014年 TW. All rights reserved.
//

#import "ChangePwdViewController.h"

@interface ChangePwdViewController ()<UITextFieldDelegate>

@end

@implementation ChangePwdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitleView:@"修改密码"];
    
    _phoneTextField.delegate = self;
    _oldPwdField.delegate = self;
    _newsPwdField.delegate = self;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction)];
    [self.view addGestureRecognizer:tap];
    
    // Do any additional setup after loading the view from its nib.
}


-(IBAction)confirmAction:(id)sender{
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(changeName:oldPwd:newsPwd:)]) {
        
        [self.delegate changeName:self.phoneTextField.text oldPwd:self.oldPwdField.text newsPwd:self.newsPwdField.text];
    }
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    ;
}


- (void)viewWillDisappear:(BOOL)animated
{
    
    [super viewWillDisappear:animated];
    
    
}


-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [_oldPwdField resignFirstResponder];
    [_newsPwdField resignFirstResponder];
    [_phoneTextField resignFirstResponder];
    return YES;
}

-(void)tapAction{
    
    [_oldPwdField resignFirstResponder];
    [_newsPwdField resignFirstResponder];
    [_phoneTextField resignFirstResponder];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
